package com.xxxx.mail;

import com.xxxx.server.pojo.MailConstants;
import org.springframework.amqp.core.Queue;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;


/**
 * mail邮件服务启动类
 * Created by HMF on 2021/07/22 23:20
 */
// 去掉数据源的配置，否则启动的时候该启动类会报没有数据源的错误
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class MailApplication {

    public static void main(String[] args) {
        SpringApplication.run(MailApplication.class, args);
    }

    // 创建消息队列 名字是 mail.welcome
    @Bean
    public Queue queue() {
        return new Queue(MailConstants.MAIL_QUEUE_NAME); // 改为定义的常量
    }
}
